package com.five.taotao.guide_mine;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;

import com.five.taotao.Adapter.VPFregmentAdapter;
import com.five.taotao.R;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * gaomengjiao
 * Created by MQ on 2016/11/4.
 */
public class MoneyActivity extends AppCompatActivity {

    @BindView(R.id.back)
    ImageView back;
//    @BindView(R.id.help)
//    ImageView help;
    @BindView(R.id.tab)
    TabLayout tab;
    @BindView(R.id.vp)
    ViewPager vp;
    private List<Fragment> mData;
    private List<String> list;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_money);
        ButterKnife.bind(this);
        initData();
        VPFregmentAdapter adapter=new VPFregmentAdapter(getSupportFragmentManager(),mData,list);
        vp.setAdapter(adapter);
        tab.setupWithViewPager(vp);//两者实现联动
    }
    /**
     * 初始化数据
     */
    private void initData() {
        mData = new ArrayList<>();
        mData.add(new MoneyFragment());
        mData.add(new CouponFragment());

        list = new ArrayList<>();
        list.add("淘淘红包");
        list.add("店铺优惠券");
    }
    @OnClick({R.id.back})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.back:
                finish();
                break;

        }
    }
}
